import br.com.nooclix.salon.ui.util.ResponseData;
import br.com.nooclix.salon.ui.util.WindowsMessage;

import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;

public function statesResult(event:ResultEvent):void{
	var responseData:ResponseData = event.result as ResponseData;
	
	if(responseData.status == ResponseData.ok()){
		cbState.dataProvider = responseData.items;
		cbState.labelField = "name";
		
		getCitiesBySelectedState();
	}else{
		WindowsMessage.alarm("Estados nao poderam ser caregadas\n "+responseData.message);
	}
} 

public function findByStateResult(event:ResultEvent):void{
	var responseData:ResponseData = event.result as ResponseData;
	
	if(responseData.status == ResponseData.ok()){
		cbCity.dataProvider = responseData.items;
		cbCity.labelField = "name";
		
		//Se no caso de estar atualizando ou visualizando alguem carregar a cidade salva no banco!
		if(person != null){
			loadCityOfEntity();
		}
		
	}else{
		WindowsMessage.alarm("Cidades nao poderam ser caregadas\n "+responseData.message);
	}
}